home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene 96
/
Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso
/
misc
/
coding
/
vgacodng
/
part08_c.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-12-15
|
2KB
|
89 lines
program Plasma_ASM;
uses crt;
var Wert1,Wert2,Wert3,Wert4 : byte;
TWert1,TWert2,TWert3,TWert4 : byte;
SinTab : array[0..255] of byte;
n1,n2 : word;
col : byte;
procedure SetPal(col,r,g,b:byte);
begin
port[$3C8] := col;
port[$3C9] := r;
port[$3C9] := g;
port[$3C9] := b;
end;
procedure CalcSinus(Ofs,Amp:byte;Len,Par:word);
begin
for n1 := 0 to Len do SinTab[n1] := round(sin(n1/Par*pi*Len/180*2)*Amp)+Ofs;
end;
begin
CalcSinus(32,31,255,360);
asm mov ax,13h; int 10h end;
for n1 := 0 to 127 do begin
setpal(n1,n1 div 6,n1 div 3,n1 div 3);
setpal(255-n1,n1 div 6,n1 div 3,n1 div 3);
end;
asm
mov ax,0A000h { VGA-Segment nach ES }
mov es,ax
@mainloop:
xor di,di { Bildschirmoffset auf 0 }
mov al,Wert3 { Werte sichern }
mov TWert3,al
mov al,Wert4
mov TWert4,al
mov n1,0 { Zähler initialisieren }
@loop1:
mov al,Wert1 { Werte sichern }
mov TWert1,al
mov al,Wert2
mov TWert2,al
mov n2,0 { Zähler initialisieren }
@loop2:
xor bx,bx { Farbwert wird in BX berechnet }
mov al,TWert4 { Index holen }
xor ah,ah
mov si,ax
mov al,[si+offset SinTab] { Wert auslesen }
add bx,ax { und auf BX addieren }
mov al,TWert3
mov si,ax
mov al,[si+offset SinTab]
add bx,ax
mov al,TWert2
mov si,ax
mov al,[si+offset SinTab]
add bx,ax
mov al,TWert1
mov si,ax
mov al,[si+offset SinTab]
add bx,ax
mov es:[di],bl { Pixel setzen }
inc di { Bildschirmoffset erhöhen }
add TWert1,4 { Indizes erhöhen }
add TWert2,3
inc n2
cmp n2,320
jne @loop2
add TWert3,4
add TWert4,5
inc n1
cmp n1,200
jne @loop1
sub Wert1,4
add Wert3,4
mov ah,0Bh
int 21h
or al,al
jz @mainloop
end;
readkey;
asm mov ax,3; int 10h end;
end.